<template>
  <div>
    <form>
      商品名称：<input type="text" v-model="update.productName"/><br/>
      商品价格：<input type="text" v-model="update.price"/><br/>
      上架时间：<input type="date" v-model="update.createTime"/><br/>
    </form>
    <button @click="sub">提交</button>
  </div>
</template>

<script>

  export default {
    name: "",
    data() {
      return {
        update: {}

      }
    },
    methods: {
      sub: function () {
        this.$axios.post("/product/updateOrSave", this.update).then(res => {
          this.$router.push("/")

        })

      }
    },
    mounted() {
      var pro = this.$route.params.update;
      if (pro != null) {
        this.update = pro;
      }


    }
  }
</script>

<style scoped>

</style>
